package com.ccrfid.rmc6.entity.business.patrol;

import com.ccrfid.rmc6.appconfig.jackson.CustomDouble4Serialize;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import javax.persistence.*;
import java.sql.Date;

@Entity
@Table(name = "patrol_schedule")
public class PatrolScheduleEntity {
    private Long id;
    private Date dutyDate;
    private Long groupId;
    private String groupName;
    private Long timeRangeId;
    private Integer patrolStatus;   //-1：未检查；0-正常；1-异常；2-缺勤
    @JsonSerialize(using = CustomDouble4Serialize.class)
    private Double completionRate;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "duty_date", nullable = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    public Date getDutyDate() {
        return dutyDate;
    }

    public void setDutyDate(Date dutyDate) {
        this.dutyDate = dutyDate;
    }

    @Basic
    @Column(name = "group_id", nullable = false)
    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    @Basic
    @Column(name = "group_name", length = 90)
    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    @Basic
    @Column(name = "time_range_id", nullable = false)
    public Long getTimeRangeId() {
        return timeRangeId;
    }

    public void setTimeRangeId(Long timeRangeId) {
        this.timeRangeId = timeRangeId;
    }

    @Basic
    @Column(name = "patrol_status", nullable = false)
    public Integer getPatrolStatus() {
        return patrolStatus;
    }

    public void setPatrolStatus(Integer patrolStatus) {
        this.patrolStatus = patrolStatus;
    }

    @Basic
    @Column(name = "completion_rate", nullable = false)
    public Double getCompletionRate() {
        return completionRate;
    }

    public void setCompletionRate(Double completionRate) {
        this.completionRate = completionRate;
    }
}
